<?php include './application/views/common/zhs_header.php';?>
<div class="newtitle-box">
  <div class="newtitle w">
    <span class="invlist_title">您现在的位置：<a href="index.html">首页</a>><a class="red" href="#">论坛</a></span>
  </div>
</div>

<?php include './application/views/forum/zhs_title.php';?>

<div class="login_box w">
	<div class="login_box w">
		<form  method="post" id="forumForm" name="forumForm"  enctype="multipart/form-data">
		<input type="hidden" value="<?php echo $post_id;?>" name="post_id" id="post_id" />
		<input type="hidden" value="submit" name="act" id="act" />
		<div id="forum-title">
			<input id="title" name="title" class="bbsin"  type="text" placeholder="请在这里输入内容标题" maxlength="128">
		</div>
		
		
		<script type="text/javascript" charset="utf-8" src="/static/zhsjr/js/ueditor/ueditor.config.js"></script>
    	<script type="text/javascript" charset="utf-8" src="/static/zhsjr/js/ueditor/ueditor.all.js"></script>
    	<script type="text/javascript" charset="utf-8">
	          var editor = new baidu.editor.ui.Editor();
	          editor.render('content');  //editor为编辑器容器的id
	    </script>
	    <div class="forum-content">
	   	 <textarea name="content" id="content" style="width:100%;height: 340px;"></textarea>
		</div>
		
		<div class="forum-usual">
			<div class="forum-button"> 
				<input  class="btnstyle-weak" type="button" name="fabiao" id="fabiao" value="发表" onclick="forumPublish(1)"/>
				<input class="btnstyle-weak" type="button" name="caogao" id="caogao" value="保存草稿" onclick="forumPublish(2)"/>
				<a href="#" target="_blank" >草稿箱（<span id="cntcaogao"><?php echo $post_count;?></span>）</a>
			</div>
		</div>
		</form>
	</div>
</div>
<script type="text/javascript">

function forumPublish(type){
	$.ajax({
		type: "POST",
		url: "/forum/forumPost",
		data: $("#forumForm").serialize()+"&type="+type,
		success: function(ret){
			if(ret.msg == 'fail'){
				alert("保存失败");
			}else{
				if(ret.msg == 1){
					alert("发送成功,请等待审核！");
					 window.location.href = "/forum";
				}else{
					$("#cntcaogao").html(ret.cnt);
					alert("保存草稿成功");
				}
				
			}
		},
		dataType: "json"
	});	
}

</script>
<?php include './application/views/common/zhs_footer.php';?>
<?php include './application/views/common/zhs_right.php';?>

